FROM ubuntu:18.04

LABEL maintainer="A Coder"
ENV CLOUDREVE_VERSION "3.0.0"

WORKDIR /work
VOLUME [ "/work/db" ]
VOLUME [ "/work/uploads" ]
VOLUME [ "/work/aria2" ]

COPY docker-entrypoint.sh .
    
RUN sed -i "s/archive.ubuntu.com/mirrors.aliyun.com/g" /etc/apt/sources.list \
    && apt-get update \
    && apt-get install -y aria2 wget \
    && wget https://github.com/cloudreve/Cloudreve/releases/download/$CLOUDREVE_VERSION/cloudreve_${CLOUDREVE_VERSION}_linux_amd64.tar.gz \
    && tar -zxvf cloudreve_${CLOUDREVE_VERSION}_linux_amd64.tar.gz \
    && apt-get purge -y --auto-remove wget \
    && rm -rf /var/lib/apt/lists/* \
    && rm -f cloudreve_${CLOUDREVE_VERSION}_linux_amd64.tar.gz

EXPOSE 5212

ENTRYPOINT [ "/work/docker-entrypoint.sh" ]